import request from '@/utils/request'

// 分页查询站点信息
export function getSiteInfo(pageNum, pageSize, name, id, type) {
  return request({
    url: '/business/site/getPage',
    params: {
      pageNum,
      pageSize,
      // 站点名称
      name,
      // 站点编码
      id,
      // 站点类型
      type
    }
  })
}

// 新增站点
export function addSite(data) {
  console.log(data)
  return request({
    url: '/business/site/save',
    method: 'post',
    data
  })
}

// 查询站点名称是否存在
export function searchSiteName(name) {
  return request({
    url: '/business/site/repeat',
    params: name
  })
}

// 获取所有站点名称
export function getAllSiteName() {
  return request({
    url: '/business/site/getSiteNames'
  })
}

// 根据ID删除站点
export function deleteSiteByID(data) {
  return request({
    url: '/business/site/delete',
    method: 'post',
    data
  })
}

// 修改站点
export function alterSite(data) {
  console.log(data)
  return request({
    url: '/business/site/edit',
    method: 'post',
    data
  })
}

// 根据ID获取站点详情
export function getSiteDetailByID(id) {
  return request({
    url: '/business/site/getDetailsById',
    params: id
  })
}

// 获取站点和ID的键值对
export function getSiteNameAndId() {
  return request({
    url: '/business/site/getSiteNameAndId'
  })
}
// 下载列表
export function exportlistsite(data) {
  return request({
    url: '/business/site/export',
    params: data,
    responseType: 'blob'
  })
}
